package cn.funeralobjects.minecraft.handler.impl;

import cn.funeralobjects.minecraft.handler.BasePlayerLoginHandler;
import cn.funeralobjects.minecraft.model.LoginResult;
import cn.funeralobjects.minecraft.model.Player;
import cn.funeralobjects.minecraft.service.MinecraftAuthService;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

/**
 * @author FuneralObjects
 * Create date: 2020/12/6 11:05 PM
 */
@Component
public class StopLoginTestHandler extends BasePlayerLoginHandler {

    @Resource
    private MinecraftAuthService minecraftAuthService;

    @PostConstruct
    private void init() {
        minecraftAuthService.insert(0, this);
    }

    @Override
    public LoginResult checkCanLogin(Player player) {
        return new LoginResult().setFailedMessage("It's test login checking. Always failed!").setSuccess(false);
    }
}
